<template>
  <van-field v-model="result" is-link readonly name="datePicker" label="时间选择" placeholder="点击选择时间"
    @click="showPicker = true" />
  <van-popup v-model:show="showPicker" position="bottom">
    <van-date-picker @confirm="onConfirm" @cancel="showPicker = false" />
  </van-popup>
</template>

<script setup>
import { ref } from 'vue';
const result = ref('');
const showPicker = ref(false);
const onConfirm = ({ selectedValues }) => {
  result.value = selectedValues.join('/');
  showPicker.value = false;
};
</script>

<style lang="scss" scoped></style>